package com.sgolub.commanndsonline.dao.sec;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.sgolub.commanndsonline.domain.sec.SecUser;


@Repository
public class SecUserDAOImpl implements SecUserDAO {

    @Autowired
    private SessionFactory sessionFactory;
	
//	public void addSecUser(SecUser secUser) {
//		sessionFactory.getCurrentSession().save(secUser);
//
//	}

	public SecUser get(Integer id) {
		SecUser secUser = (SecUser)sessionFactory.getCurrentSession().load(SecUser.class, id);
		return secUser;
	}

	public void add(SecUser secUser) {
		sessionFactory.getCurrentSession().save(secUser);
	}

	public void update(SecUser secUser) {
		// TODO Auto-generated method stub
		
	}

	public void remove(Integer id) {
		// TODO Auto-generated method stub
		
	}

	@SuppressWarnings("unchecked")
	public List<SecUser> list() {
		return sessionFactory.getCurrentSession().createQuery("from SecUser").list();
	}

}
